import express from "express";
import dotenv from "dotenv";
import { initDB } from "./db/database.js";
import taskRoute from "./route/textRoute.js";
import cors from "cors";

dotenv.config();
const app = express();
app.use(express.json());
app.use(cors());

const db = await initDB();
app.use("/route", taskRoute(db));

const PORT = process.env.PORT || 3000;
app.listen(PORT, () =>
  console.log(`Server running on http://localhost:${PORT}`)
);
